import { Bing } from './01. Bing';
import { BiliBili } from './02. Bilibili';
import { CSDN } from './03. CSDN';
import { BaiJiaHao } from './04. 百家号';
import { BaiduTieba } from './05. 百度贴吧';
import { BaiduFanyi } from './06. 百度翻译';
import { Zhihu } from './07. 知乎';

const scripts = [Bing, BiliBili, CSDN, BaiJiaHao, BaiduTieba, BaiduFanyi, Zhihu];

console.clear();

const { hostname, pathname } = window.location;

// 找到匹配的脚本
const script = scripts.find((item) => {
    if (Array.isArray(item.hostname) && item.hostname.length > 0) {
        return item.hostname.includes(hostname);
    } else {
        return item.hostname === hostname;
    }
});

// 执行脚本
if (script) new script()?.main(pathname);